package com.zero.zeroframe.v

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.viewbinding.ViewBinding
import com.zero.zeroframe.utils.BindingReflex

/**
 * Activity基类
 * @author Zero
 * @since 2/4/24
 */
abstract class BaseActivity<VB : ViewBinding> : AppCompatActivity() {

    protected val mBinding: VB by lazy(mode = LazyThreadSafetyMode.NONE) {
        BindingReflex.reflexViewBinding(javaClass, layoutInflater)
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(mBinding.root)
        setStatusBar()
        mBinding.initView()
        initData()
    }

    abstract fun VB.initView()

    open fun initData() {}
    open fun setStatusBar() {
//        BarUtils.setStatusBarLightMode(this, true)
    }

    open fun getContext() = this

}